<template>
  <div class="content">
    <div class="virusNewUp">
      <div class="virusNewUpText lineEllipsis">新增生物剂详情 -- {{vname}}</div>
      <div class="virusNewUpBut" @click="returnTo()">返回</div>
    </div>
    <div class="virusNewCenter">
      <div class="newTitle">
        <div class="newLeft">显示顺序</div>
        <div class="titleRight">
          <input type="text" v-model="virusSummaryOrder">
        </div>
      </div>
      <div class="newTitle" style="margin-top:20px;">
        <div class="newLeft">详情名称</div>
        <div class="titleRight">
          <input type="text" v-model="virusSummaryTitle">
        </div>
      </div>
      <div class="newDescribe">
        <div class="newLeft">详情描述</div>
        <div class="describeRight">
          <!-- <textarea cols="30" rows="10" v-model="virusSummaryDescribe"></textarea> -->
          <wEditor @change="valChange" :value="virusSummaryDescribe"></wEditor>
        </div>
      </div>
    </div>
    <div class="virusNewUp">
      <div class="virusNewUpBut" @click="save()">保存</div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      vid: '',
      vname: '',
      virusSummaryOrder: '',
      virusSummaryTitle: '',
      virusSummaryDescribe: '',
    };
  },
  components: {},
  computed: {},
  mounted() {
    this.vid= this.$route.query.vid;
    this.vname= this.$route.query.vname;
  },
  methods: {
    //返回上一页
    returnTo(){
      this.$router.go(-1);
    },
    valChange(val) {
      this.virusSummaryDescribe = val;
    },
    save(){
      if(this.virusSummaryTitle == ""){
          alert('请填写详情名称');
          return;
      }
      if(this.virusSummaryDescribe == ""){
          alert('请填写详情描述');
          return;
      }
      this.$api.dataBA
        .virusSummaryAdd({
          // id: null,
          vir_id: this.vid,
          title: this.virusSummaryTitle,
          des: this.virusSummaryDescribe,
          img_url: "",
          status: 1,
          vir_name: this.vname,
          detail_order: this.virusSummaryOrder,
        })
        .then((res) => {
          if (res.data.statu == 0) this.succeedBack();
        });
    },
    succeedBack() {
      this.$router.go(-1);
    },
  }
}
</script>
<style scoped>
.content{
  /* background-color: #CCCCCC; */
  padding: 0 10px;
}
.virusNewUp{
  width: 100%;
  height: 60px;
  font-size: 14px;
}
.virusNewUpText{
  width: 500px;
  height: 40px;
  line-height: 50px;
  color: rgb(134,141,149);
  float: left;
  margin-left: 49px;
}
.virusNewUpBut{
  width: 60px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  float: right;
  margin-top: 15px;
  border-radius: 4px;
  background-color: #3a94fa;
  color: #FFFFFF;
}
.virusNewCenter{
  width: 80%;
  margin: 0 auto;
  font-size: 14px;
}
.newLeft{
  width: 100px;
  height: 40px;
  line-height: 40px;
  color: rgb(0, 80, 178);;
}
.newTitle{
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  width: 100%;
  height: 40px;
}
.titleRight{
  flex-grow: 1;
	flex-shrink: 1;
}
.titleRight input{
  width: 100%;
  height: 100%;
  line-height: 40px;
  box-sizing: border-box;
  border: 1px solid #CCCCCC;
  border-radius: 4px;
  padding: 0 10px;
  outline: none;
}
.newDescribe{
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  width: 100%;
  height: 540px;
  margin-top: 20px;
}
.describeRight{
  flex-grow: 1;
	flex-shrink: 1;
}
.newPic{
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  width: 100%;
  height: 150px;
  margin-top: 20px;
}
.picRight{
  flex-grow: 1;
	flex-shrink: 1;
}
.uploadPic{
  width: 160px;
  height: 100px;
}
</style>